﻿using MediatR;
using SheepStorage.API.Application.Command.SheepHybridizationCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepHybridizationCommandHandler
{
    public class AddSheepHybridizationsCommandHandler : IRequestHandler<AddSheepHybridizationCommand, Results<int>>
    {

        ISheepHybridizationService _res;

        public AddSheepHybridizationsCommandHandler(ISheepHybridizationService res)
        {
            _res = res;
        }
        public async Task<Results<int>> Handle(AddSheepHybridizationCommand request, CancellationToken cancellationToken)
        {
            var list = await _res.AddSheepHybridization(request.inputlist);
            return Results<int>.DataResult(list);
        }
    }
}
